home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / plaf / basic / BasicComboBoxUI$PropertyChangeHandler.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  3.9 KB  |  119 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.beans.PropertyChangeEvent;
  4. import java.beans.PropertyChangeListener;
  5. import javax.swing.ComboBoxModel;
  6.  
  7. public class BasicComboBoxUI$PropertyChangeHandler implements PropertyChangeListener {
  8.    // $FF: synthetic field
  9.    private final BasicComboBoxUI this$0;
  10.  
  11.    public BasicComboBoxUI$PropertyChangeHandler(BasicComboBoxUI var1) {
  12.       this.this$0 = var1;
  13.    }
  14.  
  15.    // $FF: synthetic method
  16.    static BasicComboBoxUI access$0(BasicComboBoxUI$PropertyChangeHandler var0) {
  17.       return var0.this$0;
  18.    }
  19.  
  20.    public void propertyChange(PropertyChangeEvent var1) {
  21.       String var2 = var1.getPropertyName();
  22.       if (var2.equals("model")) {
  23.          ComboBoxModel var3 = (ComboBoxModel)var1.getNewValue();
  24.          ComboBoxModel var4 = (ComboBoxModel)var1.getOldValue();
  25.          if (var4 != null && this.this$0.listDataListener != null) {
  26.             var4.removeListDataListener(this.this$0.listDataListener);
  27.          }
  28.  
  29.          if (var3 != null && this.this$0.listDataListener != null) {
  30.             var3.addListDataListener(this.this$0.listDataListener);
  31.          }
  32.  
  33.          if (this.this$0.editor != null) {
  34.             this.this$0.comboBox.configureEditor(this.this$0.comboBox.getEditor(), this.this$0.comboBox.getSelectedItem());
  35.          }
  36.  
  37.          this.this$0.isMinimumSizeDirty = true;
  38.          this.this$0.comboBox.revalidate();
  39.          this.this$0.comboBox.repaint();
  40.       } else if (var2.equals("editor") && this.this$0.comboBox.isEditable()) {
  41.          this.this$0.removeEditor();
  42.          this.this$0.addEditor();
  43.       } else if (var2.equals("editable")) {
  44.          if (this.this$0.comboBox.isEditable()) {
  45.             this.this$0.comboBox.setRequestFocusEnabled(false);
  46.             if (this.this$0.popupKeyListener != null) {
  47.                this.this$0.comboBox.removeKeyListener(this.this$0.popupKeyListener);
  48.             }
  49.  
  50.             this.this$0.addEditor();
  51.             if (this.this$0.editor != null) {
  52.                this.this$0.configureEditor();
  53.             }
  54.  
  55.             this.this$0.editorFocusListener = new BasicComboBoxUI.2(this);
  56.             this.this$0.editor.addFocusListener(this.this$0.editorFocusListener);
  57.          } else {
  58.             this.this$0.comboBox.setRequestFocusEnabled(true);
  59.             if (this.this$0.popupKeyListener != null) {
  60.                this.this$0.comboBox.addKeyListener(this.this$0.popupKeyListener);
  61.             }
  62.  
  63.             this.this$0.removeEditor();
  64.             this.this$0.editor.removeFocusListener(this.this$0.editorFocusListener);
  65.          }
  66.  
  67.          this.this$0.updateToolTipTextForChildren();
  68.          this.this$0.comboBox.revalidate();
  69.          this.this$0.comboBox.validate();
  70.          this.this$0.comboBox.revalidate();
  71.          this.this$0.comboBox.repaint();
  72.       } else if (var2.equals("enabled")) {
  73.          boolean var5 = this.this$0.comboBox.isEnabled();
  74.          if (var5) {
  75.             if (this.this$0.editor != null) {
  76.                this.this$0.editor.setEnabled(true);
  77.             }
  78.  
  79.             if (this.this$0.arrowButton != null) {
  80.                this.this$0.arrowButton.setEnabled(true);
  81.             }
  82.          } else {
  83.             if (this.this$0.editor != null) {
  84.                this.this$0.editor.setEnabled(false);
  85.             }
  86.  
  87.             if (this.this$0.arrowButton != null) {
  88.                this.this$0.arrowButton.setEnabled(false);
  89.             }
  90.          }
  91.  
  92.          this.this$0.comboBox.repaint();
  93.       } else if (var2.equals("maximumRowCount")) {
  94.          if (this.this$0.isPopupVisible(this.this$0.comboBox)) {
  95.             this.this$0.setPopupVisible(this.this$0.comboBox, false);
  96.             this.this$0.setPopupVisible(this.this$0.comboBox, true);
  97.          }
  98.       } else if (var2.equals("font")) {
  99.          this.this$0.listBox.setFont(this.this$0.comboBox.getFont());
  100.          if (this.this$0.editor != null) {
  101.             this.this$0.editor.setFont(this.this$0.comboBox.getFont());
  102.          }
  103.  
  104.          this.this$0.isMinimumSizeDirty = true;
  105.          this.this$0.comboBox.validate();
  106.       } else if (var2.equals("ToolTipText")) {
  107.          this.this$0.updateToolTipTextForChildren();
  108.       } else if (var2.equals("JComboBox.lightweightKeyboardNavigation")) {
  109.          Object var6 = var1.getNewValue();
  110.          if (var6.equals("Lightweight")) {
  111.             BasicComboBoxUI.access$1(this.this$0, true);
  112.          } else if (var6.equals("Heavyweight")) {
  113.             BasicComboBoxUI.access$1(this.this$0, false);
  114.          }
  115.       }
  116.  
  117.    }
  118. }
  119.